package com.prompt;

import com.prompt.SensorHandle.AcceHandler;
import com.prompt.utils.CommonUtil;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity {

	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		init();
		setBt();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
		
	}
	
	private void init(){
		Effecter.getInstance().setMContext(this);
		CommonUtil.getInstance().setmContext(this);
	}

	private void setBt(){
		 Button btService =(Button)findViewById(R.id.bt_service); 
		 btService.setOnClickListener(toServiceListener);   
		 
		 Button btToSetList =(Button)findViewById(R.id.bt_to_set_list); 
		 btToSetList.setOnClickListener(new ToSetListener());  
	}

	 private Button.OnClickListener toServiceListener =new Button.OnClickListener(){  
		 public void onClick(View v) {   
			 startService(new Intent(MainActivity.this, MainService.class));
		 }
	 };

	 class ToSetListener implements OnClickListener{
		public void onClick(View v) {   
			 startActivity(new Intent(MainActivity.this, MainSetActivity.class));
		}
	 }
	 
	 class EffecterListener implements OnClickListener{
			public void onClick(View v) {   
				Effecter.getInstance().test();
			}
		 }
}
